// pages/video/video.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    video:0,
    tab: [{
        name: "热门视频"
      },
      {
        name: "推荐看看"
      },
      {
        name: "周年视频"
      },
      {
        name: "奥教育"
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      tel: wx.getStorageSync('tel')
    })
    wx.setStorageSync('ajy',0)
    var that = this
    wx.request({
      url: "https://miniapp.odeman.com/summercamp/vedio.php",
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        console.log(res.data)
        that.setData({
          videolist: res.data.lists_hot,
          lists_hot: res.data.lists_hot,
          lists_tuijian: res.data.lists_tuijian,
          lists_wq: res.data.lists_wq,
          lists_ajy: res.data.lists_ajy
        })
      }
    })
  },
  video: function (e) {
    console.log(e.currentTarget.dataset.id)
    var type = e.currentTarget.dataset.id
    wx.setStorageSync('ajy',type)
    var res = []
    if (type == "0") {
      res = this.data.lists_hot
    }
    else if (type == "1") {
      res = this.data.lists_tuijian
    }
    else if (type == "2") {
      res = this.data.lists_wq
    }
    else {
      res = this.data.lists_ajy
    }
    this.setData({
      video: type,
      videolist: res

    })

  },

  video_detail: function(e) {
    var ids = e.currentTarget.dataset.id;
    console.log(ids)
    wx.navigateTo({
      url: '../video_detail/video_detail?id=' + ids,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})